package com.guigu.controller;

import com.guigu.dto.PhysiqueEvaluationDTO;
import com.guigu.entity.PhysiqueEvaluation;
import com.guigu.service.PhysiqueEvaluationService;
import com.guigu.service.PsychologicalevaluationService;
import com.guigu.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Psychologicalevaluation")
public class PsychologicalevaluationController {
    @Autowired
    private PsychologicalevaluationService service;

    /**
     * 查询
     * @param pe
     * @return
     */
    @PostMapping("/query")
    @ResponseBody
    public Result query(@RequestBody PhysiqueEvaluationDTO pe){
        return new Result<>("200", "true", "成功查询列表",this.service.queryPhysiqueEvaluation(pe));
    }

    /**
     * 删除
     * @param pe
     * @return
     */
    @PostMapping("/delete")
    @ResponseBody
    public Result delete(@RequestBody PhysiqueEvaluation pe){
        this.service.deleteById(pe.getId());
        return new Result<>("200", "true", "成功删除",null);
    }

    /**
     * 添加
     * @param pe
     * @return
     */
    @PostMapping("/add")
    @ResponseBody
    public Result add(@RequestBody PhysiqueEvaluation pe){
        this.service.add(pe);
        return new Result<>("200", "true", "成功查询用户列表", null);
    }
    @PostMapping("/queryById")
    @ResponseBody
    public Result queryById(@RequestBody PhysiqueEvaluation pe){
        return new Result<>("200", "true", "成功查询", this.service.queryById(pe.getId()));
    }
}
